package dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import model.Prova;
import model.Questoes;

public class QuestoesDAO {
 
	 private EntityManager em;
		
		public QuestoesDAO(EntityManager em){
			this.em = em;
		}
		
		public void adicionarQuestoesDAO(Questoes q){
			q.setProva(em.merge(q.getProva()));
			em.merge(q);
		}
		public void remove(Questoes q) {
			q.setProva(null);
			Questoes q1 = em.merge(q);
			em.remove(q1);		
		}
		public List<Questoes> listar() {
			Query q = em.createQuery("select u from Questoes u");
			return q.getResultList();
		}

		public List<Questoes> buscar(Prova prova) {
			// TODO Auto-generated method stub
			return null;
		}
}
